/*
 * Copyright (c) 2020. bmy
 */

export function Autowired(params?: any) {
  return (target: any, propertyKey: string) => {
    let typeClass = Reflect.getMetadata('design:type', target, propertyKey);
    Object.defineProperty(target, propertyKey, {
      value: params ? new typeClass(new params) : new typeClass(),
      writable: true,
      configurable: true
    });
  }
}
